package com.prp.db;

import com.prp.db.idao.IArtificialNeighborRecommendationRecordDAO;
import com.prp.db.idao.IArtificialSubjectRecommendationRecordDAO;
import com.prp.db.idao.IAuthenticationDAO;
import com.prp.db.idao.ICommunityDAO;
import com.prp.db.idao.IGradeDAO;
import com.prp.db.idao.IKeywordsLibDAO;
import com.prp.db.idao.IKeywordsOfRecommendationDAO;
import com.prp.db.idao.IMailDAO;
import com.prp.db.idao.IMailboxDAO;
import com.prp.db.idao.IMsgboardDAO;
import com.prp.db.idao.INeighbourRelationshipDAO;
import com.prp.db.idao.IRecommendationEntityDAO;
import com.prp.db.idao.IScoreRecordDAO;
import com.prp.db.idao.ISearchRecordDAO;
import com.prp.db.idao.ISubjectCategoryDAO;
import com.prp.db.idao.ISubjectChildCategoryDAO;
import com.prp.db.idao.ISubjectCommentDAO;
import com.prp.db.idao.ISubjectRecommendationDAO;
import com.prp.db.idao.ITempKeywordDAO;
import com.prp.db.idao.IUserInformationDAO;
import com.prp.db.idao.IUserRecommendationDAO;
import com.prp.db.idao.IUserStateDAO;

public abstract class DAOFactory {
	// public static final int MYSQL = 1;
	// public static final int SQL_SERVER = 2;

	private static Object initLock = new Object();
	private static String className = "com.example.dao.imp.HibernateDAOFactory";
	private static DAOFactory factory = null;

	public static DAOFactory getDAOFactory() {
		if (factory == null) {
			synchronized (initLock) {
				if (factory == null) {
					String classNameProp = DAOConfig
							.getProperty("DAOFactory.className");
					// System.out.println("classNameProp:"+classNameProp);
					if (classNameProp != null) {
						className = classNameProp;
					}
					try {
						Class c = Class.forName(className);
						factory = (DAOFactory) c.newInstance();
					} catch (Exception e) {
						System.err.println("Failed to load DAOFactoryclass"
								+ className + ".");
						e.printStackTrace();
						return null;
					}
				}
			}
		}
		return factory;
	}

	public abstract IArtificialNeighborRecommendationRecordDAO getArtificialNeighborRecommendationRecordDAO();

	public abstract IArtificialSubjectRecommendationRecordDAO getArtificialSubjectRecommendationRecordDAO();

	public abstract ICommunityDAO getCommunityDAO();

	public abstract IGradeDAO getGradeDAO();

	public abstract IKeywordsLibDAO getKeywordsLibDAO();

	public abstract IMsgboardDAO getMsgboardDAO();

	public abstract INeighbourRelationshipDAO getNeighbourRelationshipDAO();

	public abstract IRecommendationEntityDAO getRecommendationEntityDAO();

	public abstract IScoreRecordDAO getScoreRecordDAO();

	public abstract ISearchRecordDAO getSearchRecordDAO();

	public abstract ISubjectChildCategoryDAO getSubjectChildCategoryDAO();

	public abstract ISubjectCategoryDAO getSubjectCategoryDAO();

	public abstract ISubjectCommentDAO getSubjectCommentDAO();

	public abstract ISubjectRecommendationDAO getSubjectRecommendationDAO();

	public abstract IUserInformationDAO getUserInformationDAO();

	public abstract IKeywordsOfRecommendationDAO getKeywordsOfRecommendationDAO();

	public abstract IAuthenticationDAO getAuthenticationDAO();

	public abstract ITempKeywordDAO getTempKeywordDAO();

	public abstract IMailDAO getMailDAO();

	public abstract IUserStateDAO getUserStateDAO();

	public abstract IMailboxDAO getMailboxDAO();
	
	public abstract IUserRecommendationDAO getUserRecommendationDAO();
}
